home *** CD-ROM | disk | FTP | other *** search
/ Education (Super OZ Shareware) / Education (Super OZ Shareware).iso / arj / arjsort.bat < prev    next >
DOS Batch File  |  1993-07-20  |  3KB  |  150 lines

  1. @echo off
  2.  
  3. echo ARJSORT 2.21, ARJ file sorting tool, Copyright (c) 1990,91 Robert K. Jung
  4. echo .
  5.  
  6. if "%1"=="" goto param_error
  7.  
  8. if "%2"=="" goto sort_start
  9. if %2==/A goto sort_start
  10. if %2==/a goto sort_start
  11. if %2==/C goto sort_start
  12. if %2==/c goto sort_start
  13. if %2==/D goto sort_start
  14. if %2==/d goto sort_start
  15. if %2==/E goto sort_start
  16. if %2==/e goto sort_start
  17. if %2==/F goto sort_start
  18. if %2==/f goto sort_start
  19. if %2==/O goto sort_start
  20. if %2==/o goto sort_start
  21. if %2==/P goto sort_start
  22. if %2==/p goto sort_start
  23. if %2==/R goto sort_start
  24. if %2==/r goto sort_start
  25. if %2==/S goto sort_start
  26. if %2==/s goto sort_start
  27. if %2==/T goto sort_start
  28. if %2==/t goto sort_start
  29. goto param_error
  30.  
  31. :sort_start
  32. echo Getting current order of archive: %1
  33. arj v %1 -jv1 -jp- > arjsort.$$1
  34. if errorlevel 1 goto arj_error
  35.  
  36. if "%2"=="" goto sort_path
  37. if %2==/A goto sort_attr
  38. if %2==/a goto sort_attr
  39. if %2==/C goto sort_crc
  40. if %2==/c goto sort_crc
  41. if %2==/D goto sort_date
  42. if %2==/d goto sort_date
  43. if %2==/E goto sort_ext
  44. if %2==/e goto sort_ext
  45. if %2==/F goto sort_file
  46. if %2==/f goto sort_file
  47. if %2==/O goto sort_ratio
  48. if %2==/o goto sort_ratio
  49. if %2==/P goto sort_path
  50. if %2==/p goto sort_path
  51. if %2==/R goto r_sort_path
  52. if %2==/r goto r_sort_path
  53. if %2==/S goto sort_size
  54. if %2==/s goto sort_size
  55. if %2==/T goto sort_time
  56. if %2==/t goto sort_time
  57. goto param_error
  58.  
  59. :sort_path
  60. echo Sorting by pathname
  61. echo .
  62. SORT /+122 %3 < arjsort.$$1 > arjsort.$$$
  63. goto sort_finish
  64.  
  65. :r_sort_path
  66. echo Sorting by pathname
  67. echo .
  68. SORT /+122 %2 < arjsort.$$1 > arjsort.$$$
  69. goto sort_finish
  70.  
  71. :sort_attr
  72. echo Sorting by attribute
  73. echo .
  74. SORT /+69  %3 < arjsort.$$1 > arjsort.$$$
  75. goto sort_finish
  76.  
  77. :sort_crc
  78. echo Sorting by CRC
  79. echo .
  80. SORT /+60  %3 < arjsort.$$1 > arjsort.$$$
  81. goto sort_finish
  82.  
  83. :sort_date
  84. echo Sorting by date/time modified
  85. echo .
  86. SORT /+41  %3 < arjsort.$$1 > arjsort.$$$
  87. goto sort_finish
  88.  
  89. :sort_ext
  90. echo Sorting by file extension
  91. echo .
  92. SORT /+81  %3 < arjsort.$$1 > arjsort.$$$
  93. goto sort_finish
  94.  
  95. :sort_file
  96. echo Sorting by filename
  97. echo .
  98. SORT /+89  %3 < arjsort.$$1 > arjsort.$$$
  99. goto sort_finish
  100.  
  101. :sort_ratio
  102. echo Sorting by compression ratio
  103. echo .
  104. SORT /+36  %3 < arjsort.$$1 > arjsort.$$$
  105. goto sort_finish
  106.  
  107. :sort_size
  108. echo Sorting by original file size
  109. echo .
  110. SORT /+14  %3 < arjsort.$$1 > arjsort.$$$
  111. goto sort_finish
  112.  
  113. :sort_time
  114. echo Sorting by time modified
  115. echo .
  116. SORT /+51  %3 < arjsort.$$1 > arjsort.$$$
  117. goto sort_finish
  118.  
  119. :sort_finish
  120. if errorlevel 1 goto sort_error
  121.  
  122. arj o %1 -!! -jp- !arjsort.$$$
  123. if errorlevel 1 goto arj_error
  124. goto stop
  125.  
  126. :arj_error
  127. echo ARJ error processing %1
  128. goto stop
  129.  
  130. :sort_error
  131. echo Sort error processing %1
  132. goto stop
  133.  
  134. :param_error
  135. echo . Usage:  ARJSORT archive [/order] [/r]
  136. echo .           Where /order is one of the following:
  137. echo .
  138. echo .             /a = attribute      /o = ratio
  139. echo .             /c = crc          /p = pathname
  140. echo .             /d = date/time      /s = size
  141. echo .             /e = extension      /t = time
  142. echo .             /f = filename
  143. echo .
  144. echo .           [/r]everse, if specified, must be the last option.
  145.  
  146. :stop
  147. if exist arjsort.$$1 del arjsort.$$1 > NUL
  148. if exist arjsort.$$$ del arjsort.$$$ > NUL
  149. if exist arjsort.bak del arjsort.bak > NUL
  150.